package com.wxh.bomb.netty.thread.executor;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

/**
 * 实现newScheduledThreadPool 实现定时处理
 *
 * @author wxh
 * @date：2017.10.13
 */
public class ScheduledJob {

    public static void main(String args[]) throws Exception {
        Temp command = new Temp();
        ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
        ScheduledFuture<?> scheduleTask = scheduler.scheduleWithFixedDelay(command, 5, 1, TimeUnit.SECONDS);
    }

}

class Temp extends Thread {
    @Override
    public void run() {
        System.out.println("run");
    }
}